import Vue from "vue";
import VueRouter from "vue-router";
import Layout from '@/views/layout/Index.vue'
import Login from '@/views/login/Index.vue'
import Home from '@/views/home/Home.vue'
import Product from '@/views/product/Index.vue'
import Category from '@/views/product/category/Index.vue'
import List from "@/views/product/list/Index.vue"
import Order from "@/views/order/Index.vue"
import Liebiao from "@/views/order/liebiao/Index.vue"
import Qingdan from "@/views/order/qingdan/Index.vue"
import Shenhe from "@/views/order/shenhe/Index.vue"
import Advert from "@/views/advert/Index.vue"
import Dinglist from "@/views/advert/dinglist/Index.vue"
// const Product = ()=> import("@/views/product/Index.vue")
// const Category = ()=> import("@/views/product/category/Index.vue")
// const List = ()=> import("@/views/product/list/Index.vue")

Vue.use(VueRouter)

const routes =[
    {
        path:'/',
        component:Layout,
        children:[
            {
                path:'/',
                name:'home',
                component:Home
            },
            {
                path:'/product',
                name:'product',
                component:Product,
                children:[
                    {
                        path:'category',   //访问路径：/product/list
                        name:'category',
                        component:Category 
                    },
                    {
                        path:'list',
                        name:'list',
                        component:List
                    }
                ]
            },
            {
                path:'/order',
                name:'order',
                component:Order,
                children:[
                    {
                        path:'liebiao',
                        name:'liebiao',
                        component:Liebiao
                    },
                    {
                        path:'qingdan',
                        name:'qingdan',
                        component:Qingdan
                    },
                    {
                        path:'shenhe',
                        name:'shenhe',
                        component:Shenhe
                    }
                ]
            },
            {
                path:'/advert',
                name:'advert',
                component:Advert,
                children:[
                    {
                        path:'dinglist',
                        name:'dinglist',
                        component:Dinglist
                    }
                ]
            }
        ]
    },
    {
        path:'/login',  
        name:'login',
        component:Login
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router